<template>
  <view class="page-container">
    <view>
      <!-- 页面内容 -->
      <h1>页面---view1</h1>
      <h1>页面---view1</h1>
      <h1>页面---view1</h1>

      <h1 style="margin-top: 40px" @click="count += 1">
        点击此处 计数count {{ count }}
      </h1>
    </view>

    <!--    #ifdef APP-PLUS-->
    <view @click="openAndroidpop" style="font-size: 25px ;color: #007AFF">点击此处 打开不可关闭窗口-APP <span
        style="font-size: 30px">index</span>
    </view>
    <!--    #endif-->

    <!--   #ifdef MP-WEIXIN-->
    <view @click="openWxMiniPop" style="font-size: 25px ;color: #007AFF">点击此处 打开不可关闭窗口-小程序 <span
        style="font-size: 30px">index</span>
    </view>

    <uni-popup ref="popup" type="bottom" border-radius="10px 10px 0 0" :mask-click="false">
      <view style="color: #8a0ad5;font-size: 16px">
        <view>弹出层-index-index--禁止关闭...禁止切换....</view>
        <view>--view1--view1...view1....</view>
        <view>--view1--view1...view1....</view>
        <view>弹出层-view1-view1--禁止关闭...禁止切换....</view>
        <view style="height: 20px"></view>
        <view @click="closeWxMiniPop" style="font-size: 25px ;color: #007AFF">点击此处 关闭小程序遮罩层</view>
      </view>
    </uni-popup>
    <!--    #endif-->

  </view>
</template>

<script>

import {volleyFlag} from "@/util/util";

export default {
  components: {},
  data() {
    return {
      count: 0,
      activeTab: 0,
    };
  },
  onLoad() {
    console.log("------onLoad------22222222222222")
  },
  onShow() {
    // #ifdef MP-WEIXIN
    console.log("------onShow------222222222222222")
    // this.$nextTick(() => {
    // setTimeout(() => {
    volleyFlag("/pages/view1/view1")
    // }, 300)
    // })
    // #endif

    // #ifdef APP-PLUS
    const subNVue = uni.getSubNVueById("popup");
    subNVue.show("fade-in", 200, () => {
      uni.$emit("page-popup", {
        view: "1",
      });
    });
    // #endif

  },
  methods: {
    // #ifdef MP-WEIXIN
    openWxMiniPop() {
      uni.setStorageSync("volleyTag", "volleySwitch");
      uni.setStorageSync("backUrl", "/pages/view1/view1");
      this.$refs.popup.open('center')
    },
    closeWxMiniPop() {
      console.log("closeWxMiniPop")
      uni.setStorageSync("volleyTag", "");
      uni.setStorageSync("backUrl", "");
      this.$refs.popup.close()
    },
    // #endif

    // #ifdef APP-PLUS
    openAndroidpop() {
      const subNVue = uni.getSubNVueById("popup");
      subNVue.show("fade-in", 200, () => {
        uni.$emit("page-popup", {
          view: "2",
        });
      });
    },
    // #endif
  },
};
</script>
<style scoped>
.show {
  display: none;
}

.hide {
  display: block;
}
</style>
